package system

import "gorm.io/gorm"

type User struct {
	gorm.Model
	Username string  `gorm:"type:varchar(20);not null;unique" json:"username"`
	Password string  `gorm:"size:255;not null" json:"password"`
	Nickname *string `gorm:"type:varchar(20)" json:"nickname"`
	Remark   *string `gorm:"type:varchar(100)" json:"remark"`
	DeptId   *int    `gorm:"type:int(16)" json:"deptId"`
	Mobile   string  `gorm:"type:varchar(11);not null;unique" json:"mobile"`
	Sex      uint    `gorm:"type:tinyint(1);default:1" json:"sex"`
	Avatar   *string  `gorm:"type:varchar(255)" json:"avatar"`
	Status   uint    `gorm:"type:tinyint(1);default:1;comment:'1正常, 2禁用, 3全部'" json:"status"`
	Creator  string  `gorm:"type:varchar(20);" json:"creator"`
	Roles    []*Role `gorm:"many2many:user_roles" json:"roles"`
}
